package com.ibeeking.found.file.rest.controller.v1;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ibeeking.found.file.rest.service.INoticeService;
import com.ibeeking.found.file.service.common.dos.NoticeDO;
import com.ibeeking.found.file.service.common.query.NoticePageQuery;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
/**
 * @ClassName FileController
 * @Description 公告管理
 * @Author ibeeking
 * @Date 2021-06-02 18:15
 **/
@RestController
@RequestMapping("/notice/v1")
public class NoticeController {
    public static final String CURRENT_MODULE = "公告管理";

    @Resource
    private INoticeService noticeServiceImpl;

    /**
     * 得到所有的公告
     *
     * @return
     */
    @Log(logType = OperateLogTypeEnum.QUERY, describe = "得到所有的公告列表")
    @GetMapping(value = "/list")
    public Page<NoticeDO> selectUserList(@RequestBody NoticePageQuery pageQuery) {
        Page<NoticeDO> noticeIPage = noticeServiceImpl.selectUserPage(pageQuery);

        return noticeIPage;
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询公告详情")
    @GetMapping(value = "/detail/{noticeId}")
    public NoticeDO getNoticeDetail(@PathVariable("noticeId") long noticeId) {
        NoticeDO notice = noticeServiceImpl.getById(noticeId);

        return notice;
    }




}
